<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title></title>
<?php
  include_once 'public/views/header.php';
  include_once 'public/home/html/fullCalendar.php';
?>
  <script src="public/home/js/function.js"></script>
</head>
<style>
  body{
    background-color: white;
    /*height:100%;*/
  }
  #calendar{
    padding:10px!important;
    background-color: white;
    /*height:100%;*/
  }
</style>
<body>


<div class="page-container container">
      <div class="col-md-12 calendar-col col-item">
        <div id="calendar"></div>
      </div>
</body>
<script>

$(function(){
  getClass();
})

function getClass(){
  $('#calendar').fullCalendar({
      header: {
        // left: 'prev,next today',
        left: '',
        center: 'title',
        right: 'listDay,month,basicWeek'
      },
      aspectRatio:2,
      defaultView: "listDay",
      firstHour:6,  
      // defaultDate: '2019-01-12',
      navLinks: true, // can click day/week names to navigate views
      editable: false,
      eventLimit: true, // allow "more" link when too many events
      eventClick:function(event, jsEvent, view){//当点击日历中的某一日程（事件）时，触发此操作
        // event.title = "CLICKED!";
        // $('#calendar').fullCalendar('updateEvent', event);
        showClass(event.id);
      },
      dayClick: function(date, allDay, jsEvent, view) { //当单击日历中的某一天时，触发callback
        /*var views = $('#calendar').fullCalendar('getView'); */
        // showAddWorkArrangementAddView(jsDataToPhpDate(date));
      },
      events: function(start, end, timezone, callback) {
        $.ajax({
          type: "post",
          url: "Admin/Classes/getClass",
          data:{},
          dataType:'json',
           // async: true,
          success: function(data) {
            if(data.status) {
              var t=JSON.parse(data.v);
              // work_arrangement=t;
              callback(t);
            } else {
              window.parent.topMessagePrompt('error',data.msg);
            }
          }
        });
      }
    });
}

function updateClass(){
  $('#calendar').fullCalendar( 'refetchEvents' );
}


function showClass(id){
  showDialogModal(getRootPath()+'/Admin/Classes/showClass/'+id,400,450);
}






</script>

</html>